﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Xml;

namespace SDB2DM.Feature.CurveStyle
{
    class Railway : Feature
    {
        public Railway(XmlDocument doc, XmlNode objectNode)
            : base(doc, objectNode,
                Utility.FEATURE_RAILWAY, Utility.APP_RAILWAY_TAG, 
                Utility.APP_RAILWAY_TAG, Utility.SPATIAL_ID_PREFIX_CURVE)
        {
            //FeatureName = Utility.FEATURE_RAILWAY;
            //FeatureTag = Utility.APP_RAILWAY_TAG;
            //FeatureID = Utility.APP_RAILWAY_TAG;
            //PositionIdref = Utility.SPATIAL_ID_PREFIX_CURVE;
        }

        public override void BuildApplicationData()
        {
            XmlNamespaceManager nsmgrJPS = null;
            XmlNodeList nodeList = null;

            nsmgrJPS = new XmlNamespaceManager(XMLDoc.NameTable);
            nsmgrJPS.AddNamespace(Utility.CM_JPS_TAG, Utility.JPS_URI);

            nodeList = ObjectNode.SelectNodes(
                Utility.CM_JPS_TAG + ":" + Utility.SPATIAL_CURVE_TAG, nsmgrJPS);

            int currentRowNo = 0;
            foreach (XmlNode node in nodeList)
            {
                if (Utility.datasetPoint[node.Attributes[Utility.CM_ATTRIBUTE_ID_TAG].Value].ToString()
                    == Utility.FEATURE_RAILWAY)
                {
                    BuildXMLForAppSchema(
                        ObjectNode,
                        node.Attributes[Utility.CM_ATTRIBUTE_ID_TAG].Value,
                        Utility.IDValueFormat,
                        ++currentRowNo);
                }
            }
        }
    }
}
